package ui.view;

import static constants.GTextbookConstants.Chinese;
import static constants.GTextbookConstants.English;
import static constants.GTextbookConstants.authorContext;

import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.tree.DefaultMutableTreeNode;

import ui.Utility;

public class IndexTreeNode extends DefaultMutableTreeNode{
	
	public IndexTreeNode (String role, String name, int language){
		
		this(new NodeInfo(authorContext.getUserContext(), role, name));
        //set whether allow children for the node
        if(Utility.checkOntology("roleOntology", role, "precursor", "Category", "subsequence", "is")){
      	  setAllowsChildren(true);
        }else{
      	  setAllowsChildren(false);
        }
	}
	
	public IndexTreeNode(Object object, int language){
		this(object);
		this.language = language;

	}
	
	public IndexTreeNode(Object object){
		super(object);
		this.name = object.toString();
		this.object = object;
		
		
	}
	
	
	
	
	
	public Object getObject() {
		return object;
	}

	public void setObject(Object object) {
		this.object = object;
	}

	public IndexTreeNode (String name){
		
		super(name);
		this.name = name;
	}

	
	public String getXmlPath() {
		return xmlPath;
	}
	public void setXmlPath(String xmlPath) {
		this.xmlPath = xmlPath;
	}
	
	public String getName() {
		return name;
	}


	public void setName(String name) {
		this.name = name;
	}
	
	
	private String xmlPath;
	private String name;
	private int language;
	private Object object;

}
